import service from '@/utils/request';
import { findUrl } from '../globleApiSetting/globleApiSetting';
const apiName = 'staffApi'


/**
 * 导出员工信息
 */
export function DownLoadEmployeeDatas(data: any) {
    return service({
        url: '/itf/employee/web/employee/export',
        method: 'get',
        responseType: 'blob',
        data
    })
}

/**
 * 自定义下拉添加标志符
 * @param params 默认 dictKey: 'customFieldModule'
 * @returns 
 */
export function GetCustomFieldModule(params: {}) {
    return service({
        url: '/itf/general/web/dict/data',
        method: 'get',
        params
    })
}

/**
 * 分页查询离职员工列表
 * @param params 
 * @returns 
 */
export function GetResignationByPage(params: any) {
    return service({
        url: '/itf/employee/web/employee/resignation/page',
        method: 'get',
        params
    })
}

/**
 * 根据id关联查询字典数据接口
 * @param params 
 * @returns 
 */
export function GetBatchDictAllListByIds(params: any) {
    const api = findUrl(apiName, '/itf/organization/web/dict/data/batch');
    return service({
        url: api?.staffUrl,
        method: api?.methods,
        params
    })

}


/**
 * 查询字典数据接口
 * @param params 
 * @returns 
 */
export function GetDictAllList(params: any) {
    const api = findUrl(apiName, '/itf/organization/web/dict/info');
    return service({
        url: api?.staffUrl,
        method: api?.methods,
        params
    })

}

/**
 * 分页查询字典数据接口
 * @param params 
 * @returns 
 */
export function GetCustomfieldAllListsByPage(params: any) {
    return service({
        url: "/itf/organization/web/custom/field/page",
        method: 'get',
        params
    })

}

/**
 * 分页查询字典数据接口
 * @param params 
 * @returns 
 */
export function GetDictListsByPage(params: any) {
    return service({
        url: "/itf/organization/web/custom/dict/info/page",
        method: 'get',
        params
    })

}
/**
 * 根据uuid查询字典数据接口
 * @param params 
 * @returns 
 */
export function GetDictDetailList(uuid: any, params: any) {
    const api = findUrl(apiName, '/itf/organization/web/dict/info/uuid');
    return service({
        url: api?.staffUrl + '/' + uuid,
        method: api?.methods,
        params
    })
}

/**
 * 新增字典信息接口
 * @param params 
 * @returns 
 */
export function AddDictInfoList(data: any) {
    const api = findUrl(apiName, '/itf/organization/web/dict/info');
    return service({
        url: api?.staffUrl,
        method: 'post',
        data
    })
}

/**
 * 修改字典信息接口
 * @param params 
 * @returns 
 */
export function UpdateDictInfoList(uuid: any, data: any) {
    const api = findUrl(apiName, '/itf/organization/web/dict/info/uuid');
    return service({
        url: api?.staffUrl + '/' + uuid,
        method: 'put',
        data
    })
}


/**
 * 新增字典数据接口
 * @param params 
 * @returns 
 */
export function AddDictList(data: any) {
    const api = findUrl(apiName, '/itf/organization/web/dict/data');
    return service({
        url: api?.staffUrl,
        method: 'post',
        data
    })
}

/**
 * 删除字典数据接口
 * @param params 
 * @returns 
 */
export function DeleteDictList(data: any) {
    const api = findUrl(apiName, '/itf/organization/web/dict/data/uuid');
    return service({
        url: api?.staffUrl + '/' + data.uuid,
        method: 'delete',
        data
    })
}

/**
 * 修改字典数据接口
 * @param params 
 * @returns 
 */
export function UpdateDictList(uuid: any, data: any) {
    const api = findUrl(apiName, '/itf/organization/web/dict/data/uuid');
    return service({
        url: api?.staffUrl + '/' + uuid,
        method: 'put',
        data
    })
}


/**
 * 根据公司id查询字典数据接口
 * @param params 
 * @returns 
 */
export function GetDictInfoList(params: any) {
    // const api = findUrl(apiName, '/prod-api');
    return service({
        url: '/itf/organization/web/dict/info',
        method: 'GET',
        params
    })
}


/**
 * 根据dictInfoId查询字典数据接口
 * @param params 
 * @returns 
 */
export function GetDictDetailByDictInfoIdList(params: any) {
    const api = findUrl(apiName, '/itf/organization/web/dict/data');
    return service({
        url: api?.staffUrl,
        method: api?.methods,
        params
    })
}


/**
 * 查询自定义接口
 * @param params 
 * @returns 
 */
export function GetCustomfieldAllList(params: any) {
    const api = findUrl(apiName, '/itf/organization/web/custom/field');
    return service({
        url: api?.staffUrl,
        method: api?.methods,
        params
    })

}

/**
 * 新增自定义接口
 * @param params 
 * @returns 
 */
export function AddCustomfield(data: any) {
    const api = findUrl(apiName, '/itf/organization/web/custom/field');
    return service({
        url: api?.staffUrl,
        method: 'post',
        data
    })

}

/**
 * 修改自定义接口
 * @param params 
 * @returns 
 */
export function UpdatetCustomfieldById(uuid: any, data: {}) {
    const api = findUrl(apiName, '/itf/organization/web/custom/field/uuid');
    return service({
        url: api?.staffUrl + '/' + uuid,
        method: 'put',
        data
    })

}

/**
 * 删除自定义接口
 * @param params 
 * @returns 
 */
export function DeleteCustomfieldByUuid(uuid: any) {
    const api = findUrl(apiName, '/itf/organization/web/custom/field/uuid');
    return service({
        url: api?.staffUrl + `/${uuid}`,
        method: 'delete'
    })

}




/**
 * 查询公司
 * @param params 
 * @returns 
 */
export function GetCompanyAllList(params: any) {
    const api = findUrl(apiName, '/itf/organization/web/enterprise');
    return service({
        url: api?.staffUrl,
        method: api?.methods,
        params
    })

}



/**
 * 员工查询列表所有
 * @param params 
 * @returns 
 */
export function GetEmployeeAllList(params: any) {
    const api = findUrl(apiName, '/itf/employee/web/employee');
    return service({
        url: api?.staffUrl,
        method: api?.methods,
        params
    })

}


/**
 * 根据uuid查员工详情
 * @param uuid uuid
 * @param params 查询字段obj
 * @returns 
 */
export function GetEmployeeDetailByUUID(uuid: any, params: any) {
    const api = findUrl(apiName, '/itf/employee/web/employee/uuid');
    return service({
        url: api?.staffUrl + '/' + uuid,
        method: api?.methods,
        params
    })

}

/**
 * 根据uuid删除员工详情
 * @param uuid uuid
 * @param params 查询字段obj
 * @returns 
 */
export function DeleteEmployeeDetailByUUID(uuid: any) {
    const api = findUrl(apiName, '/itf/employee/web/employee/uuid');
    return service({
        url: api?.staffUrl + '/' + uuid,
        method: 'DELETE'
    })

}


/**
 * 员工查询列表分页查
 * @param params 
 * @returns 
 */
export function GetEmployeeAllListByPage(params: { pageNo: 1, pageSize: 10 }) {
    // consolelog(params);

    const api = findUrl(apiName, "/itf/employee/web/employee/page");
    return service({
        url: api?.staffUrl,
        method: api?.methods,
        params,
    });
}

/**
 * 员工add
 * @param params 
 * @returns 
 */
export function AddEmployee(data: any) {
    const api = findUrl(apiName, '/itf/employee/web/employee');
    return service({
        url: api?.staffUrl,
        method: 'post',
        data
    })

}

/**
 * 员工update
 * @param params 
 * @returns 
 */
export function UpdateEmployee(uuid: any, data: any) {
    const api = findUrl(apiName, '/itf/employee/web/employee/uuid');
    return service({
        url: api?.staffUrl + '/' + uuid,
        method: 'PUT',
        data
    })

}

/**
 * 员工delete
 * @param params 
 * @returns 
 */
export function DeleteEmployee(uuid: any) {
    const api = findUrl(apiName, '/itf/employee/web/employee/uuid');
    return service({
        url: api?.staffUrl + '/' + uuid,
        method: 'DELETE'
    })

}



/**
 * 员工家庭信息添加
 * @param data 
 * @returns 
 */
export function AddFamliyInfoAdd(data: object) {
    return service({
        url: '/itf/employee/web/family/member',
        method: 'post',
        data
    })

}

/**
 * 查询员工家庭信息列表(全量查询)
 * @param data 
 * @returns 
 */
export function GetEmployeeFamily(params: any) {
    return service({
        url: `/itf/employee/web/family/member`,
        method: "get",
        params
    });
}

/**
 * 查询国家列表(全量查询)
 * @param 
 * @returns 
 */
export function GetCountryLists() {
    return service({
        url: `/itf/general/web/country`,
        method: "get",
    });
}

/**
 * 新增账户信息
 * @param 
 * @returns 
 */
export function AddBankAccount(data: object) {
    return service({
        url: `/itf/employee/web/bank_account`,
        method: "post",
        data,
    });
}

/**
 * 查询账户信息
 * @param 
 * @returns 
 */
export function GetAccountInfo(employeeId: string) {
    return service({
        url: `/itf/employee/web/bank_account/by_employee_id/${employeeId}`,
        method: "get",
    });
}

/**
 * 通过uuid查询账户详情信息
 * @param 
 * @returns 
 */
export function GetAccountInfoByUuid(uuid: string) {
    return service({
        url: `/itf/employee/web/bank_account/uuid/${uuid}`,
        method: "get",
    });
}

/**
 * 删除账号信息
 * @param 
 * @returns 
 */
export function DeleteBankAccount(uuid: string) {
    return service({
        url: `/itf/employee/web/bank_account/uuid/${uuid}`,
        method: "delete",
    });
}

/**
 * 银行根据uuid修改
 * @param 
 * @returns 
 */
export function PutBankAccountUuid(uuid: string, data: any) {
    return service({
        url: `/itf/employee/web/bank_account/uuid/${uuid}`,
        method: "put",
        data
    });
}

/**
 * 删除家庭信息
 * @param 
 * @returns 
 */
export function DeleteFamliyInfo(uuid: string) {
    return service({
        url: `/itf/employee/web/family/member/uuid/${uuid}`,
        method: "delete",
    });
}

/**
 * 修改家庭信息
 * @param 
 * @returns 
 */
export function UpdateFamliyInfo(uuid: string, data: object) {
    return service({
        url: `/itf/employee/web/family/member/uuid/${uuid}`,
        method: "put",
        data,
    });
}

/**
 * 根据uuid查询家庭详情信息
 * @param 
 * @returns 
 */
export function GetFamliyInfoByUuid(uuid: any) {
    return service({
        url: `/itf/employee/web/family/member/uuid/${uuid}`,
        method: "get",
    });
}

/**
 * 查询员工信息
 * @param 
 * @returns 
 */
export function queryUserInfo(id: number) {
    return service({
        url: `/itf/employee/web/employee/${id}`,
        method: "get",
    });
}

/**
 * 导出员工数据
 * @param 
 * @returns 
 */
export function GetExport(params: any) {
    return service({
        url: `/itf/employee/web/employee/export`,
        method: "get",
        params
    });
}
